package main.java.com.blog.service;

import com.blog.dao.ArtMapper;
import com.blog.entity.Art;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Admin on 2017/6/6.
 */

@SuppressWarnings("ALL")
@Service("ArtService")
public class ArtServiceImpl implements ArtService {

    @Autowired
    private ArtMapper artMapper;

    @Override
    public int addArt(Art art) {
        return artMapper.insertSelective(art);
    }

    @Override
    public int deleteByTitle(String artTitle) {
        return artMapper.deleteByArtTitle(artTitle);
    }

    @Override
    public int deleteById(int artId) {
        return artMapper.deleteByPrimaryKey(artId);
    }

    @Override
    public Art findByTitle(String artTitle) {
        return null;
    }

    @Override
    public Art findById(int id) {
        return artMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Art> findByArtAccount(String userAccount) {
        return artMapper.selectByArtAccount(userAccount);
    }

    @Override
    public List<Art> findByAll() {
        return artMapper.selectAll();
    }
}
